export interface ResultContext<T = unknown> {
  code: BusinessStatusCode;
  message: string;
  data: T;
}

export const BusinessStatusCode = {
  BUSINESS_SUCCESS: 0,

  BUSINESS_FAILURE: 1000,
  NOT_IMPLEMENTED: 1001,
  DATABASE_ERROR: 1002,

  USER_ALREADY_EXIST: 2001,
  USER_NOT_FOUND: 2002,
  PASSWORD_INCORRECT: 2003,
  NULL_KEY_FIELD: 2004,
  UNAUTHORIZED: 2005,
  SESSION_EXPIRED: 2006,

  BOOK_NOT_FOUND: 3001,
  BOOK_OUT_OF_STOCK: 3002,
  BOOK_STOCK_OVERFLOW: 3007,
  BORROW_RECORD_NOT_FOUND: 3003,
  BORROW_RECORD_STATUS_CONFLICT: 3004,
  FAVORITE_RECORD_NOT_FOUND: 3005,
  FAVORITE_RECORD_STATUS_CONFLICT: 3006,
} as const;

export type BusinessStatusCode =
  (typeof BusinessStatusCode)[keyof typeof BusinessStatusCode];
